<template>
  <div class="hm-tab">
    <div class="header">
      <img :src="item.avatar" class="avatar" />
      <div class="info">
        <div class="user">{{ item.stem }}</div>
        <div class="time">
          <span>{{ item.creator }}</span>
          <span> | </span>
          <span>{{ item.createdAt }}</span>
        </div>
      </div>
    </div>
    <div class="content" v-text="item.content"></div>
    <div class="footer">
      <span>点赞：{{ item.likeCount }}</span>
      <span>|</span>
      <span>浏览：{{ item.views }}</span>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    item: {
      type: Object,
      default() {
        return {};
      },
    },
  },
};
</script>

<style lang="less" scoped>
.user {
  font-size: 14;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}
.time {
  font-size: 11px;
  color: #999999;
}
.header {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
    border: 1px solid #ddd;
  }
}

.content {
  // 只显示两行文字
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: #666666;
  margin-bottom: 10px;
}
.footer {
  color: #9999a6;
  font-size: 13px;
}
</style>
